/**
 * 
 */
package com.swg.cocobox.filetransfer.data;

import org.apache.log4j.Logger;

import com.swg.cocobox.ResponseHandler;

/**
 * @author satriaprayoga
 *
 */
public class FileResponseHandler implements ResponseHandler{
	
	private final Logger logger=Logger.getLogger(getClass());
	
	private byte[] response;

	@Override
	public synchronized boolean handleResponse(byte[] response) {
		this.response=response;
		this.notify();
		return true;
	}

	@Override
	public void waitForResponse() {
		while(response==null){
			try {
				this.wait();
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
		logger.debug(new String(response));
		
	}

}
